]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
fingerprint: Use makeProxyWrapper for fprintManager
authorRazze <razzeee@gmail.com>
Sat, 30 Jan 2021 19:10:03 +0000 (20:10 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 8 Feb 2021 19:19:14 +0000 (19:19 +0000)
The reason this wasn't using the Gio.DBus.makeProxyWrapper() convenience API is that it passes custom flags to the proxy, and that wasn't supported by the wrapper at the time.

As this is now possible, this commit migrates us to the new API.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1572>

data/dbus-interfaces/net.reactivated.Fprint.Manager.xml [new file with mode: 0644]
data/gnome-shell-dbus-interfaces.gresource.xml
js/gdm/fingerprint.js [deleted file]
js/gdm/util.js
js/js-resources.gresource.xml

diff --git a/data/dbus-interfaces/net.reactivated.Fprint.Manager.xml b/data/dbus-interfaces/net.reactivated.Fprint.Manager.xml
new file mode 100644 (file)
index 0000000..21e03f2
--- /dev/null
@@ -0,0 +1,18 @@
+<!DOCTYPE node PUBLIC
+"-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
+"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+       <interface name="net.reactivated.Fprint.Manager">
+
+               <method name="GetDevices">
+                       <arg type="ao" name="devices" direction="out">
+                       </arg>
+               </method>
+
+               <method name="GetDefaultDevice">
+                       <arg type="o" name="device" direction="out">
+                       </arg>
+               </method>
+
+       </interface>
+</node>
index e740700390fb50e6a04520abd00eaa5988c164a5..c705a22840f6bf1cc2af8780f0eaedd17e9f89d2 100644 (file)
@@ -2,6 +2,7 @@
 <gresources>
   <gresource prefix="/org/gnome/shell/dbus-interfaces">
     <file preprocess="xml-stripblanks">net.hadess.SensorProxy.xml</file>
+    <file preprocess="xml-stripblanks">net.reactivated.Fprint.Manager.xml</file>
     <file preprocess="xml-stripblanks">org.freedesktop.Application.xml</file>
     <file preprocess="xml-stripblanks">org.freedesktop.bolt1.Device.xml</file>
     <file preprocess="xml-stripblanks">org.freedesktop.bolt1.Manager.xml</file>
diff --git a/js/gdm/fingerprint.js b/js/gdm/fingerprint.js
deleted file mode 100644 (file)
index e23a77b..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
-/* exported FprintManager */
-
-const Gio = imports.gi.Gio;
-
-const FprintManagerIface = `
-<node>
-<interface name="net.reactivated.Fprint.Manager">
-<method name="GetDefaultDevice">
-    <arg type="o" direction="out" />
-</method>
-</interface>
-</node>`;
-
-const FprintManagerInfo = Gio.DBusInterfaceInfo.new_for_xml(FprintManagerIface);
-
-function FprintManager() {
-    var self = new Gio.DBusProxy({ g_connection: Gio.DBus.system,
-                                   g_interface_name: FprintManagerInfo.name,
-                                   g_interface_info: FprintManagerInfo,
-                                   g_name: 'net.reactivated.Fprint',
-                                   g_object_path: '/net/reactivated/Fprint/Manager',
-                                   g_flags: Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES });
-
-    try {
-        self.init(null);
-    } catch (e) {
-        log(`Failed to connect to Fprint service: ${e.message}`);
-        return null;
-    }
-
-    return self;
-}
index af135746685608a71bb5f8f8c3f4bdc205303976..bcf8a514c8aab23c3888208eed389fa93ae00d25 100644 (file)
@@ -6,13 +6,16 @@ const { Clutter, Gdm, Gio, GLib } = imports.gi;
 const Signals = imports.signals;
 
 const Batch = imports.gdm.batch;
-const Fprint = imports.gdm.fingerprint;
 const OVirt = imports.gdm.oVirt;
 const Vmware = imports.gdm.vmware;
 const Main = imports.ui.main;
+const { loadInterfaceXML } = imports.misc.fileUtils;
 const Params = imports.misc.params;
 const SmartcardManager = imports.misc.smartcardManager;
 
+const FprintManagerIface = loadInterfaceXML('net.reactivated.Fprint.Manager');
+const FprintManagerProxy = Gio.DBusProxy.makeProxyWrapper(FprintManagerIface);
+
 Gio._promisify(Gdm.Client.prototype,
     'open_reauthentication_channel', 'open_reauthentication_channel_finish');
 Gio._promisify(Gdm.Client.prototype,
@@ -138,7 +141,12 @@ var ShellUserVerifier = class {
                                this._updateDefaultService.bind(this));
         this._updateDefaultService();
 
-        this._fprintManager = Fprint.FprintManager();
+        this._fprintManager = new FprintManagerProxy(Gio.DBus.system,
+            'net.reactivated.Fprint',
+            '/net/reactivated/Fprint/Manager',
+            null,
+            null,
+            Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES);
         this._smartcardManager = SmartcardManager.getSmartcardManager();
 
         // We check for smartcards right away, since an inserted smartcard
index 30582aad01b06b1aa36d0a0ebfc0e37549ed1cd9..45b5de4362db6b92b35a34585554ccb4c4df32c7 100644 (file)
@@ -3,7 +3,6 @@
   <gresource prefix="/org/gnome/shell">
     <file>gdm/authPrompt.js</file>
     <file>gdm/batch.js</file>
-    <file>gdm/fingerprint.js</file>
     <file>gdm/loginDialog.js</file>
     <file>gdm/oVirt.js</file>
     <file>gdm/credentialManager.js</file>